﻿@model Alma.Models.ListModel
@{
    ViewContext.Controller.ViewBag.Breadcrumb.Enter("Mon panier", "Show", "Cart", new { id = Session["UserId"] });
    ViewContext.Controller.ViewBag.Breadcrumb.Enter("Details de la liste");
    bool autorized = Model.ID_User != null && Session["UserId"] != null && (long)Session["UserId"] == Model.ID_User;
}
<div class="fullcol">
<div class="boxes">
    <h1>@Model.List_Name</h1>

        @if (Model.productList.Count > 0)
        {
                <table>
    <tr><th></th><th>Nom</th><th>Quantité</th><th>Magasin</th><th></th><th></th></tr>
    @foreach (var se in Model.productList)
    {
        <tr>
        <td><img alt="Product Illustration" src="@Url.Content(se.ImgUrl)" /></td>
        <td>@Html.ActionLink(se.Name, "Show", "Product", new { id = se.ID }, null)</td>
          @if (autorized)
          {
        <td>@Html.ActionLink("-", "Less", "List", new { idProduct = se.ID, idList = Model.ID }, null)@se.Quantity@Html.ActionLink("+", "More", "List", new { idProduct = se.ID, idList = Model.ID }, null)</td>
          }
          else
          {
               <td>@se.Quantity</td>
          }
               <td>@Html.ActionLink(se.Name_Shop, "Show", "Shop", new { id = se.ID_Shop }, null)</td>
        @if (autorized)
        {
        <td>@Html.ActionLink("Retirer", "DelProduct", "List", new { idProduct = se.ID, idList = Model.ID }, null)</td>
        }
        </tr>
    }
    </table>
            @Html.ActionLink("Copier dans le panier", "ListToCart", "List", new { idList = Model.ID, idUser = Session["UserID"] }, null)
       if (autorized)
       {
            <br />@Html.ActionLink("Vider la liste", "Free", "List", new { idList = Model.ID }, null)
       }
        }
        else
        {
        <p>Aucun produit dans la liste.</p>
        }
   
</div>
